function cellCenterCoordinate = CalcCellCenterStruct(mesh)

nCell = mesh.iDimensions;
if(nCell(3) ~= 1)
    nCell = nCell - 1;
else
    nCell(1) = nCell(1) -1;
    nCell(2) = nCell(2) -1;
end
cellCenterCoordinate = zeros(nCell(1),nCell(2),nCell(3));

for k = 1:nCell(3)
    for j = 1:nCell(2)
        for i = 1:nCell(1)
            cellCenterCoordinate(i,j,k) = ...
                mesh.nodeCoordinateArray(i,j,k)+...
                mesh.nodeCoordinateArray(i+1,j,k)+...
                mesh.nodeCoordinateArray(i,j+1,k)+...
                mesh.nodeCoordinateArray(i+1,j+1,k);
            if(nCell(3) ~= 1)
                cellCenterCoordinate(i,j,k) = cellCenterCoordinate(i,j,k)+...
                    mesh.nodeCoordinateArray(i,j,k+1)+...
                    mesh.nodeCoordinateArray(i+1,j,k+1)+...
                    mesh.nodeCoordinateArray(i,j+1,k+1)+...
                    mesh.nodeCoordinateArray(i+1,j+1,k+1);
            end
        end
    end
end

if(nCell(3) ~= 1)
    cellCenterCoordinate = cellCenterCoordinate./8;
else
    cellCenterCoordinate = cellCenterCoordinate./4;
end